package service

import (
	"blog/internal/model"
	"blog/internal/repository"
)

type ArticleService struct {
	repo *repository.ArticleRepository
}

func NewArticleService(repo *repository.ArticleRepository) *ArticleService {
	return &ArticleService{repo: repo}
}

func (s *ArticleService) GetAll() ([]model.Article, error) {
	return s.repo.FindAll()
}

func (s *ArticleService) GetByID(id uint) (model.Article, error) {
	return s.repo.FindByID(id)
}

//func (s *ArticleService) Create(article *model.Article) error {
//	if article.Title == "" {
//		return errors.New("title cannot be empty")
//	}
//	return s.repo.Create(article)
//}
//
//func (s *ArticleService) Update(id uint, article *model.Article) error {
//	return s.repo.Update(id, article)
//}
//
//func (s *ArticleService) Delete(id uint) error {
//	return s.repo.Delete(id)
//}
